<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: #f5f5f5;
        }

        #app {
            width: 480px;
            height: 80px;
            margin: 200px auto;
        }

        .input-num {
            margin-top: 20px;
            height: 100%;
            display: flex;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 4px 4px 4px #adadad;
            border: 1px solid #c7c7c7;
            background-color: #c7c7c7;
        }

        .input-num button {
            width: 150px;
            height: 100%;
            font-size: 40px;
            color: #ad2a27;
            cursor: pointer;
            border: none;
            outline: none;
            background-color: rgba(0, 0, 0, 0);
        }

        .input-num span {
            height: 100%;
            font-size: 40px;
            flex: 1;
            text-align: center;
            line-height: 80px;
            font-family: auto;
            background-color: white;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="input-num">
            <button @click="sub">-</button>
            <span>{{num}}</span>
            <button @click="add">+</button>
        </div>
    </div>
    <script src="http://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                num: 1
            },
            methods: {
                add: function () {
                    if (this.num < 10) {
                        this.num++
                    } else {
                        alert(11)
                    }
                },
                sub: function () {
                    if (this.num > 0) {
                        this.num--
                    } else {
                        alert(22)
                    }
                }
            },
        })
    </script>
</body>

</html>